import { ZFormItemSchema } from "@/components/Form/typings";
import { ZTableColumn } from "@/components/Table/typings";
import { DateRender, UserRender } from "@/lib/octp/renderHelpers";

export const getColumns = (): ZTableColumn[] => [
  {
    title: "Id(测试用)",
    key: "id",
  },
  {
    title: "Name",
    key: "name",
  },
  {
    title: "Price",
    key: "price",
    sorter: true,
  },
  {
    title: "Description",
    key: "description",
  },
  {
    title: "Provider",
    key: "provider",
    render({ rowData }: any) {
      return UserRender(rowData.provider);
    },
  },
  {
    title: "Consumer",
    key: "consumer",
    render({ rowData }: any) {
      return UserRender(rowData.consumer);
    },
  },
  {
    title: "CreatedAt",
    key: "createdAt",
    render({ rowData }: any) {
      return DateRender(rowData.createdAt);
    },
    sorter: true,
  },
];

export const getSearchSchemas = (): ZFormItemSchema[] => [
  {
    label: "商品名",
    path: "name",
    span: 12,
  },
];
